= error_messages_for :event
#flash= flash[:error]
#content-title
  %h1 Edit Event
  %p Go ahead and edit the event details below
#event-listings
  .listing
    - form_for @event, event_url, :method => 'put' do |form| 
      %table
        %tr
          %th Name:
          %td= form.text_field :name
          %td= error_message_on :event, :name
        %tr
          %th Place:
          %td= form.text_field :place
          %td= error_message_on :event, :place
        %tr
          %th Starting Time:
          %td= form.datetime_select("start_time",:default => 1.hour.from_now)
          %td= error_message_on :event, :start_time    
        %tr
          %td Optional Details:
        %tr
          %th Ending Time 
          %td= form.datetime_select("end_time",:default => 2.hours.from_now)
        %tr
          %th Cost:
          %td= form.text_field :cost
          %td= error_message_on :event, :cost
        %tr 
          %th Description:
          %td= form.text_area :description
          %td= error_message_on :event, :description 
        - if @event.series  
        %tr
          %th Event Series
          %td
            %select{:name => "event[series_id]"}  
              - @series.each do |series|
                %option{:value => series.id, :selected => ('selected' if series.id == @event.series.id) }= series.name
        - end 
        %tr
          %th{:colspan => "0"} To add a category to this event select a category from the drop down menu and press "Add Category"
        %tr  
          %th Category
          %td
            %select{:name => "event[category_ids][]", :multiple => "multiple", :size => "10"}
              - @categories.each do |category|
                %option{:value => category.id, :selected => ('selected' if @event.category_ids.include?(category.id))}= category.name
      = submit_tag 'Update'
    - form_for @event, event_url, :html => {:class => 'delete', :method => :delete} do |form|
      = submit_tag 'Delete'